# -*- coding: utf-8 -*-
from src.com.ydzy.app.stragety_init import env
from src.com.ydzy.util.base_util import BaserUtil
from src.com.ydzy.util.http_util import HttpClient

http_client = HttpClient()
base_client=BaserUtil()

active=env.active
env_dict={
    'test':'https://audit.gat.gz/',
    'local':'http://localhost:20028/',
}
interface='auditcenter/log_strategies/'
base_strategy_id=11

init_param=\
{
    "logType": "010",
    "sysId": "",
    "type": "01",
    "name": "令牌处理日志策略系统Z",
    "desc": "令牌处理日志策略系统Z",
    "auditStatus": "1",
    "status": "1",
    "fieldInfos": [
        {
            "sortNum": 1,
            "relType": "01",
            "showOpt": "01,02,03",
            "pageOptJson": {
                "field": "logId",
                "type": "input",
                "label": "日志标识"
            },
            "fieldName": "logId",
            "fieldZh": "日志标识",
            "fieldType": "string",
            "fieldFormat": "",
            "fieldDesc": "日志标识类型",
            "isInternal": "1",
            "isMust": "1",
            "validateType": "02",
            "dataRule": "Z_dataRule01",
            "ruleReverse": "0",
            "expression": "",
            "usageOpt": "01",
            "blockType": "01",
            "mustAdvise": "日志标识完整性检查项",
            "ruleAdvise": "日志标识规则性检查项",
            "mustScore": 1,
            "ruleScore": 1,
            "queryOpt": "",
            "status": "1",
            "createTime": "2024-05-30 15:04:44",
            "updateTime": "2024-05-30 16:16:21"
        },
        {
            "sortNum": 2,
            "relType": "01",
            "showOpt": "01,02,03",
            "pageOptJson": {
                "field": "operateType",
                "type": "select",
                "label": "操作类型",
                "optionKey": "code",
                "optionName": "content",
                "dictType": "z_operate_type"
            },
            "fieldName": "operateType",
            "fieldZh": "操作类型",
            "fieldType": "string",
            "fieldFormat": "",
            "fieldDesc": "操作类型类型",
            "isInternal": "1",
            "isMust": "1",
            "validateType": "02",
            "dataRule": "Z_dataRule02",
            "ruleReverse": "0",
            "expression": "code@audit_dict@type='z_operate_type'",
            "usageOpt": "01",
            "blockType": "01",
            "mustAdvise": "操作类型完整性检查项",
            "ruleAdvise": "操作类型规则性检查项",
            "mustScore": 1,
            "ruleScore": 1,
            "queryOpt": "",
            "status": "1",
            "createTime": "2024-05-30 14:29:24",
            "updateTime": "2024-05-30 16:10:15"
        },
        {
            "sortNum": 3,
            "relType": "01",
            "showOpt": "01,02,03",
            "pageOptJson": {
                "field": "operateId",
                "type": "select",
                "label": "功能模块",
                "optionKey": "code",
                "optionName": "content",
                "dictType": "z_operate_id"
            },
            "fieldName": "operateId",
            "fieldZh": "功能模块",
            "fieldType": "string",
            "fieldFormat": "",
            "fieldDesc": "功能模块类型",
            "isInternal": "1",
            "isMust": "1",
            "validateType": "02",
            "dataRule": "Z_dataRule03",
            "ruleReverse": "0",
            "expression": "code@audit_dict@type='z_operate_id'",
            "usageOpt": "01",
            "blockType": "01",
            "mustAdvise": "功能模块完整性检查项",
            "ruleAdvise": "功能模块规则性检查项",
            "mustScore": 1,
            "ruleScore": 1,
            "queryOpt": "",
            "status": "1",
            "createTime": "2024-05-30 14:36:29",
            "updateTime": "2024-05-30 16:10:15"
        },
        {
            "sortNum": 4,
            "relType": "01",
            "showOpt": "01,02,03",
            "pageOptJson": {
                "field": "operateTime",
                "type": "input",
                "label": "操作时间"
            },
            "fieldName": "operateTime",
            "fieldZh": "操作时间",
            "fieldType": "string",
            "fieldFormat": "",
            "fieldDesc": "操作时间类型",
            "isInternal": "1",
            "isMust": "1",
            "validateType": "02",
            "dataRule": "Z_dataRule04",
            "ruleReverse": "0",
            "expression": "^\\d{10}$",
            "usageOpt": "01",
            "blockType": "01",
            "mustAdvise": "操作时间完整性检查项",
            "ruleAdvise": "操作时间规则性检查项",
            "mustScore": 1,
            "ruleScore": 1,
            "queryOpt": "",
            "status": "1",
            "createTime": "2024-05-30 14:42:59",
            "updateTime": "2024-05-30 16:10:15"
        },
        {
            "sortNum": 5,
            "relType": "01",
            "showOpt": "01,02,03",
            "pageOptJson": {
                "field": "tokenType",
                "type": "select",
                "label": "处理令牌类型",
                "optionKey": "code",
                "optionName": "content",
                "options": [
                    {
                        "code": "usertoken",
                        "content": "用户令牌"
                    },
                    {
                        "code": "apptoken",
                        "content": "应用令牌"
                    }
                ]
            },
            "fieldName": "tokenType",
            "fieldZh": "处理令牌类型",
            "fieldType": "string",
            "fieldFormat": "",
            "fieldDesc": "处理令牌类型类型",
            "isInternal": "1",
            "isMust": "1",
            "validateType": "02",
            "dataRule": "Z_dataRule05",
            "ruleReverse": "0",
            "expression": "^(usertoken|apptoken)$",
            "usageOpt": "01",
            "blockType": "01",
            "mustAdvise": "处理令牌类型完整性检查项",
            "ruleAdvise": "处理令牌类型规则性检查项",
            "mustScore": 1,
            "ruleScore": 1,
            "queryOpt": "",
            "status": "1",
            "createTime": "2024-05-30 15:14:52",
            "updateTime": "2024-05-30 16:10:15"
        },
        {
            "sortNum": 6,
            "relType": "01",
            "showOpt": "01,02,03",
            "pageOptJson": {
                "field": "appId",
                "type": "input",
                "label": "应用信息"
            },
            "fieldName": "appId",
            "fieldZh": "应用信息",
            "fieldType": "string",
            "fieldFormat": "",
            "fieldDesc": "应用信息类型",
            "isInternal": "1",
            "isMust": "1",
            "validateType": "02",
            "dataRule": "Z_dataRule06",
            "ruleReverse": "0",
            "expression": "",
            "usageOpt": "01",
            "blockType": "01",
            "mustAdvise": "应用信息完整性检查项",
            "ruleAdvise": "应用信息规则性检查项",
            "mustScore": 1,
            "ruleScore": 1,
            "queryOpt": "",
            "status": "1",
            "createTime": "2024-05-30 15:04:44",
            "updateTime": "2024-05-30 16:16:21"
        },
        {
            "sortNum": 7,
            "relType": "01",
            "showOpt": "02,03",
            "pageOptJson": {
                "field": "userToken",
                "type": "input",
                "label": "用户令牌",
                "searchType": "term"
            },
            "fieldName": "userToken",
            "fieldZh": "用户令牌",
            "fieldType": "string",
            "fieldFormat": "",
            "fieldDesc": "用户令牌",
            "isInternal": "1",
            "isMust": "0",
            "validateType": "",
            "dataRule": "",
            "ruleReverse": "0",
            "usageOpt": "01",
            "blockType": "01",
            "status": "1",
            "createTime": "2024-05-21 11:53:01",
            "updateTime": "2024-05-30 10:43:43"
        },
        {
            "sortNum": 8,
            "relType": "01",
            "showOpt": "02,03",
            "pageOptJson": {
                "field": "appToken",
                "type": "input",
                "label": "应用令牌",
                "searchType": "term"
            },
            "fieldName": "appToken",
            "fieldZh": "应用令牌",
            "fieldType": "string",
            "fieldFormat": "",
            "fieldDesc": "应用令牌",
            "isInternal": "1",
            "isMust": "0",
            "validateType": "",
            "dataRule": "",
            "ruleReverse": "0",
            "usageOpt": "01",
            "blockType": "01",
            "status": "1",
            "createTime": "2024-05-21 11:53:01",
            "updateTime": "2024-05-30 10:43:43"
        },
        {
            "sortNum": 9,
            "relType": "01",
            "showOpt": "01,02,03",
            "pageOptJson": {
                "field": "userId",
                "type": "input",
                "label": "用户信息"
            },
            "fieldName": "userId",
            "fieldZh": "用户信息",
            "fieldType": "string",
            "fieldFormat": "",
            "fieldDesc": "用户信息类型",
            "isInternal": "1",
            "isMust": "0",
            "validateType": "02",
            "dataRule": "Z_dataRule09",
            "ruleReverse": "0",
            "expression": "",
            "usageOpt": "01",
            "blockType": "01",
            "mustAdvise": "用户信息完整性检查项",
            "ruleAdvise": "用户信息规则性检查项",
            "mustScore": 1,
            "ruleScore": 1,
            "queryOpt": "",
            "status": "1",
            "createTime": "2024-05-30 14:42:59",
            "updateTime": "2024-05-30 16:10:15"
        },
        {
            "sortNum": 10,
            "relType": "01",
            "showOpt": "01,02,03",
            "pageOptJson": {
                "field": "reqApp",
                "type": "input",
                "label": "行为发起方"
            },
            "fieldName": "reqApp",
            "fieldZh": "行为发起方",
            "fieldType": "string",
            "fieldFormat": "",
            "fieldDesc": "行为发起方类型",
            "isInternal": "1",
            "isMust": "1",
            "validateType": "02",
            "dataRule": "Z_dataRule10",
            "ruleReverse": "0",
            "expression": "",
            "usageOpt": "01",
            "blockType": "01",
            "mustAdvise": "行为发起方完整性检查项",
            "ruleAdvise": "行为发起方规则性检查项",
            "mustScore": 1,
            "ruleScore": 1,
            "queryOpt": "",
            "status": "1",
            "createTime": "2024-05-30 14:42:59",
            "updateTime": "2024-05-30 16:10:15"
        },
        {
            "sortNum": 11,
            "relType": "01",
            "showOpt": "01,02,03",
            "pageOptJson": {
                "field": "operateOrg",
                "type": "input",
                "label": "所属单位"
            },
            "fieldName": "operateOrg",
            "fieldZh": "所属单位",
            "fieldType": "string",
            "fieldFormat": "",
            "fieldDesc": "所属单位类型",
            "isInternal": "1",
            "isMust": "0",
            "validateType": "02",
            "dataRule": "Z_dataRule11",
            "ruleReverse": "0",
            "expression": "",
            "usageOpt": "01",
            "blockType": "01",
            "mustAdvise": "所属单位完整性检查项",
            "ruleAdvise": "所属单位规则性检查项",
            "mustScore": 1,
            "ruleScore": 1,
            "queryOpt": "",
            "status": "1",
            "createTime": "2024-05-30 14:42:59",
            "updateTime": "2024-05-30 16:10:15"
        },
        {
            "sortNum": 12,
            "relType": "01",
            "showOpt": "01,02,03",
            "pageOptJson": {
                "field": "operateOrgname",
                "type": "input",
                "label": "所属单位名称"
            },
            "fieldName": "operateOrgname",
            "fieldZh": "所属单位名称",
            "fieldType": "string",
            "fieldFormat": "",
            "fieldDesc": "所属单位名称类型",
            "isInternal": "1",
            "isMust": "0",
            "validateType": "02",
            "dataRule": "Z_dataRule12",
            "ruleReverse": "0",
            "expression": "",
            "usageOpt": "01",
            "blockType": "01",
            "mustAdvise": "所属单位名称完整性检查项",
            "ruleAdvise": "所属单位名称规则性检查项",
            "mustScore": 1,
            "ruleScore": 1,
            "queryOpt": "",
            "status": "1",
            "createTime": "2024-05-30 14:42:59",
            "updateTime": "2024-05-30 16:10:15"
        },
        {
            "sortNum": 13,
            "relType": "01",
            "showOpt": "01,02,03",
            "pageOptJson": {
                "field": "terminalId",
                "type": "input",
                "label": "终端标识"
            },
            "fieldName": "terminalId",
            "fieldZh": "终端标识",
            "fieldType": "string",
            "fieldFormat": "",
            "fieldDesc": "终端标识",
            "isInternal": "1",
            "isMust": "0",
            "validateType": "02",
            "dataRule": "Z_dataRule13",
            "ruleReverse": "0",
            "expression": "",
            "usageOpt": "01",
            "blockType": "01",
            "mustAdvise": "终端标识完整性检查项",
            "ruleAdvise": "终端标识规则性检查项",
            "mustScore": 1,
            "ruleScore": 1,
            "queryOpt": "",
            "status": "1",
            "createTime": "2024-05-30 16:23:17",
            "updateTime": "2024-05-30 16:23:17"
        },
    ]
}



def get_req_url(active):
    req_url=env_dict[active]+interface
    return req_url


def main():
    url = get_req_url(active)+str(base_strategy_id)
    res2 = http_client.put(url=url, data=init_param, fast_falg=True)
    print(res2)


if __name__=='__main__':
    main()